package com.itheima.Controller;

import com.itheima.domain.User;
import com.itheima.service.UserService;
import com.itheima.service.impl.UserServiceImpl;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class UserController {
    private UserService userService = new UserServiceImpl();
    private User user = null;
    //查询全部
    @Test
    public void testFindAll(){
        List<User> list = userService.findAll();
        System.out.println(list);
    }
    @Test
    public void testFindById(){
        user = userService.findById(25);
        System.out.println(user);
    }
    @Test
    public void testLogin(){
        user = userService.findByNameAndPwd(25,"陈小明");
        System.out.println(user);
    }
    @Test
    public void testFindCondition(){
        user = new User();
        //user.setId(25);
        //user.setUsername("陈小明");
        user.setSex("女");
        List<User> list = userService.findCondition(user);
        System.out.println(list);
    }
    @Test
    public void testFindIds(){
        List<Integer> lists = new ArrayList<Integer>();
        lists.add(10);
        lists.add(16);
        lists.add(22);
        List<User> list = userService.findByIds(lists);
        System.out.println(list);
    }
}
